package com.heima.feigns;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.WemediaFeignFallback;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.pojos.WmNews;
import com.heima.model.wemedia.pojos.WmUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient(value = "leadnews-wemedia", //这个是要调用的自媒体微服务
        configuration = HeimaFeignAutoConfiguration.class, //feign接口配置类
        fallbackFactory = WemediaFeignFallback.class //feign降级文件
)
public interface WemediaFeign {
    @GetMapping("api/v1/user/findByName/{name}")
    public ResponseResult<WmUser> findByName(@PathVariable("name") String name);

    @PostMapping("api/v1/user/save")
    public ResponseResult<WmUser> save(@RequestBody WmUser wmUser);

    @GetMapping("api/v1/news/one/{id}")
    public ResponseResult<WmNews> findById(@PathVariable("id") Integer id);

    @PostMapping("api/v1/news/update")
    public ResponseResult update(@RequestBody WmNews wmNews);



}
